package com.jiazhong.Abstract.Demo01;

import com.jiazhong.多态and转型.Test02.B;

public class Demo03 {
    public static void main(String[] args) {
        Sum sum=new Sum();
        sum.time();;
        Mul mul=new Mul();
        mul.time();
    }
}
abstract class Base{
    public abstract void job();
    public void time(){
        long star=System.currentTimeMillis();
        job();
        long end=System.currentTimeMillis();
        System.out.println(end-star);
    }
}
class Sum extends Base{

    @Override
    public void job() {
        long sum=0;
        for (int i=1;i<=1000000;i++){
            sum+=i;
        }
    }
}
class Mul extends Base{
    @Override
    public void job() {
        long mul=1;
        for (int i=1;i<=1000000;i++){
            mul*=i;
        }
    }
}
